<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template text_ipc_message_queue_backend</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Log v2">
<link rel="up" href="../../../sinks.html#header.boost.log.sinks.text_ipc_message_queue_backend_hpp" title="Header &lt;boost/log/sinks/text_ipc_message_queue_backend.hpp&gt;">
<link rel="prev" href="text_file_backend.html" title="Class text_file_backend">
<link rel="next" href="file/file_name_composer_adapter.html" title="Class template file_name_composer_adapter">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="text_file_backend.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../sinks.html#header.boost.log.sinks.text_ipc_message_queue_backend_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="file/file_name_composer_adapter.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.log.sinks.text_ipc_message__idm34474"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template text_ipc_message_queue_backend</span></h2>
<p>boost::log::sinks::text_ipc_message_queue_backend — An implementation of a text interprocess message queue sink backend and a supporting interprocess message queue. </p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../sinks.html#header.boost.log.sinks.text_ipc_message_queue_backend_hpp" title="Header &lt;boost/log/sinks/text_ipc_message_queue_backend.hpp&gt;">boost/log/sinks/text_ipc_message_queue_backend.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> QueueT<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="text_ipc_message__idm34474.html" title="Class template text_ipc_message_queue_backend">text_ipc_message_queue_backend</a> <span class="special">:</span>
  <span class="keyword">public</span> <span class="identifier">basic_formatted_sink_backend</span><span class="special">&lt;</span> <span class="keyword">char</span><span class="special">,</span> <span class="identifier">concurrent_feeding</span> <span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">base_type</span><span class="special">::</span><span class="identifier">char_type</span>   <a name="boost.log.sinks.text_ipc_message__idm34474.char_type"></a><span class="identifier">char_type</span><span class="special">;</span>    <span class="comment">// Character type. </span>
  <span class="keyword">typedef</span> <span class="identifier">base_type</span><span class="special">::</span><span class="identifier">string_type</span> <a name="boost.log.sinks.text_ipc_message__idm34474.string_type"></a><span class="identifier">string_type</span><span class="special">;</span>  <span class="comment">// String type to be used as a message text holder. </span>
  <span class="keyword">typedef</span> <span class="identifier">QueueT</span>                 <a name="boost.log.sinks.text_ipc_message__idm34474.queue_type"></a><span class="identifier">queue_type</span><span class="special">;</span>   <span class="comment">// Interprocess message queue type. </span>

  <span class="comment">// <a class="link" href="text_ipc_message__idm34474.html#boost.log.sinks.text_ipc_message__idm34474construct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="text_ipc_message__idm34474.html#idm34529-bb"><span class="identifier">text_ipc_message_queue_backend</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">explicit</span> <a class="link" href="text_ipc_message__idm34474.html#idm34532-bb"><span class="identifier">text_ipc_message_queue_backend</span></a><span class="special">(</span><span class="identifier">queue_type</span> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span><span class="special">...</span> Args<span class="special">&gt;</span> 
    <span class="keyword">explicit</span> <a class="link" href="text_ipc_message__idm34474.html#idm34537-bb"><span class="identifier">text_ipc_message_queue_backend</span></a><span class="special">(</span><span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="text_ipc_message__idm34474.html#idm34490-bb">public member functions</a></span>
  <span class="identifier">queue_type</span> <span class="special">&amp;</span> <a class="link" href="text_ipc_message__idm34474.html#idm34491-bb"><span class="identifier">message_queue</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="identifier">queue_type</span> <span class="keyword">const</span> <span class="special">&amp;</span> <a class="link" href="text_ipc_message__idm34474.html#idm34500-bb"><span class="identifier">message_queue</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="text_ipc_message__idm34474.html#idm34509-bb"><span class="identifier">is_open</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="text_ipc_message__idm34474.html#idm34518-bb"><span class="identifier">consume</span></a><span class="special">(</span><span class="identifier">record_view</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">string_type</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm72102"></a><h2>Description</h2>
<p>The sink backend sends formatted log messages to an interprocess message queue which can be extracted by a viewer process. Methods of this class are not thread-safe, unless otherwise specified. </p>
<div class="refsect2">
<a name="idm72105"></a><h3>
<a name="boost.log.sinks.text_ipc_message__idm34474construct-copy-destruct"></a><code class="computeroutput">text_ipc_message_queue_backend</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idm34529-bb"></a><span class="identifier">text_ipc_message_queue_backend</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Default constructor. The method constructs the backend using the default-constructed interprocess message queue. The queue may need additional setup in order to be able to send messages. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">explicit</span> <a name="idm34532-bb"></a><span class="identifier">text_ipc_message_queue_backend</span><span class="special">(</span><span class="identifier">queue_type</span> <span class="special">&amp;&amp;</span> queue<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Initializing constructor. The method constructs the backend using the provided interprocess message queue. The constructor moves from the provided queue. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span><span class="special">...</span> Args<span class="special">&gt;</span> 
  <span class="keyword">explicit</span> <a name="idm34537-bb"></a><span class="identifier">text_ipc_message_queue_backend</span><span class="special">(</span><span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span> args<span class="special">)</span><span class="special">;</span></pre>
<p>Constructor that passes arbitrary named parameters to the interprocess queue constructor. Refer to the queue documentation for the list of supported parameters. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idm72151"></a><h3>
<a name="idm34490-bb"></a><code class="computeroutput">text_ipc_message_queue_backend</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">queue_type</span> <span class="special">&amp;</span> <a name="idm34491-bb"></a><span class="identifier">message_queue</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>The method returns a reference to the managed <code class="computeroutput">queue_type</code> object.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A reference to the managed <code class="computeroutput">queue_type</code> object. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">queue_type</span> <span class="keyword">const</span> <span class="special">&amp;</span> <a name="idm34500-bb"></a><span class="identifier">message_queue</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>The method returns a constant reference to the managed <code class="computeroutput">queue_type</code> object.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A constant reference to the managed <code class="computeroutput">queue_type</code> object. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm34509-bb"></a><span class="identifier">is_open</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Tests whether the object is associated with any message queue. Only when the backend has an associated message queue, will any message be sent.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">true</code> if the object is associated with a message queue, and <code class="computeroutput">false</code> otherwise. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm34518-bb"></a><span class="identifier">consume</span><span class="special">(</span><span class="identifier">record_view</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">string_type</span> <span class="keyword">const</span> <span class="special">&amp;</span> formatted_message<span class="special">)</span><span class="special">;</span></pre>
<p>The method writes the message to the backend. Concurrent calls to this method are allowed. Therefore, the backend may be used with unlocked frontend. <code class="computeroutput">stop_local()</code> can be used to have a blocked <code class="computeroutput">consume()</code> call return and prevent future calls to <code class="computeroutput">consume()</code> from blocking. </p>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2007-2024 Andrey Semashev<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>).
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="text_file_backend.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../sinks.html#header.boost.log.sinks.text_ipc_message_queue_backend_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="file/file_name_composer_adapter.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
